package com.kantboot.business.ac.domain.entity;

import com.kantboot.util.core.jpa.KantbootGenerationType;
import jakarta.persistence.*;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import java.util.Date;

@Entity
@Getter
@Setter
@Table(name = "bus_ac_recharge_product_order")
@Accessors(chain = true)
@EntityListeners(AuditingEntityListener.class)
@DynamicUpdate
@DynamicInsert
public class BusAcRechargeProductOrder {

    /**
     * 主键
     */
    @Id
    @GenericGenerator(name = "snowflakeId", strategy = KantbootGenerationType.SNOWFLAKE)
    @GeneratedValue(generator = "snowflakeId")
    @Column(name = "id")
    private Long id;

    /**
     * 订单id
     */
    @Column(name = "order_id")
    private Long orderId;

    /**
     * 关联的yrApi充值参数
     * 通过BusAcYrApiRechargeParam的out_trade_num关联order_id
     */
    @OneToOne
    @JoinColumn(name = "order_id", referencedColumnName = "out_trade_num", insertable = false, updatable = false)
    private BusAcYrApiRechargeParam apiRechargeParam;


    /**
     * 订单状态编码
     */
    @Column(name = "order_status_code")
    private String orderStatusCode;

    /**
     * 用户id
     */
    @Column(name = "user_id")
    private Long userId;

    /**
     * 产品id
     */
    @Column(name = "product_id")
    private Long productId;

    /**
     * 产品名称
     */
    @Column(name = "t_name")
    private String name;

    /**
     * 产品类型编码
     */
    @Column(name = "t_type_code")
    private String typeCode;

    /**
     * 对应的大猿人api的产品id
     */
    @Column(name = "t_api_product_id")
    private Long apiProductId;

    /**
     * 成本价
     */
    @Column(name = "t_cost_price")
    private Double costPrice;

    /**
     * 普通用户售价
     */
    @Column(name = "t_normal_user_price")
    private Double normalUserPrice;

    /**
     * vip用户售价
     */
    @Column(name = "t_vip_user_price")
    private Double vipUserPrice;

    /**
     * 合伙人售价
     */
    @Column(name = "t_partner_price")
    private Double partnerPrice;

    /**
     * 高级合伙人售价
     */
    @Column(name = "t_senior_partner_price")
    private Double seniorPartnerPrice;

    /**
     * 展示的价格
     */
    @Column(name = "t_show_price")
    private Double showPrice;

    /**
     * 描述
     */
    @Column(name = "t_description")
    private String description;

    /**
     * 提示文字
     */
    @Column(name = "t_tip")
    private String tip;

    /**
     * 创建时间
     */
    @CreatedDate
    @Column(name = "gmt_create")
    private Date gmtCreate;

    /**
     * 修改时间
     */
    @LastModifiedDate
    @Column(name = "gmt_modified")
    private Date gmtModified;


}
